﻿using System.Data.Entity;

namespace Management.Core
{
    /// <summary>
    /// 数据上下文
    /// </summary>
    public class ManagementContext: DbContext
    {
        /// <summary>
        /// 管理员集合
        /// </summary>
        public DbSet<Admin> Administrators { get; set; }


        /// <summary>
        /// 角色表
        /// </summary>
        public DbSet<Role> Role { get; set; }
        /// <summary>
        /// 管理员角色表
        /// </summary>
        public DbSet<AdminRole.AdminRole> AdminRole { get; set; }
        /// <summary>
        /// 新闻表
        /// </summary>
        public DbSet<News.News> News { get; set; }

        /// <summary>
        /// 权限表
        /// </summary>
        public DbSet<Permission.Permission> Permission { get; set; }
        
        /// <summary>
        /// 角色权限表
        /// </summary>
        public DbSet<RolePermission.RolePermission> RolePermission { get; set; }

        /// <summary>
        /// 班组表
        /// </summary>
        public DbSet<Team.Team> Team { get; set; }

        /// <summary>
        /// 车间表
        /// </summary>
        public DbSet<Workshop.Workshop> Workshop { get; set; }

        /// <summary>
        /// 设备档案表
        /// </summary>
        public DbSet<EquipmentFile.EquipmentFile> EquipmentFile { get; set; }

        /// <summary>
        /// 设备区域表
        /// </summary>
        public DbSet<EquipmentArea.EquipmentArea> EquipmentArea { get; set; }

        /// <summary>
        /// 行政区域表
        /// </summary>
        public DbSet<AdministrationArea.AdministrationArea> AdministrationArea { get; set; }

        /// <summary>
        /// 碳化硅表
        /// </summary>
        public DbSet<SiliconCarbide.SiliconCarbide> SiliconCarbide { get; set; }

        /// <summary>
        /// 钢线表
        /// </summary>
        public DbSet<SteelWire.SteelWire> SteelWire { get; set; }

        /// <summary>
        /// 悬浮液表
        /// </summary>
        public DbSet<Suspension.Suspension> Suspension { get; set; }

        /// <summary>
        /// 断线表
        /// </summary>
        public DbSet<Breaked.Breaked> Breaked { get; set; }

        /// <summary>
        /// 硅片切割表
        /// </summary>
        public DbSet<SiliconCutting.SiliconCutting> SiliconCutting { get; set; }
        
        /// <summary>
        /// 制造部表 
        /// </summary>
        public DbSet<Manufacturing.Manufacturing> Manufacturing { get; set; }

        /// <summary>
        /// 切片质量表
        /// </summary>
        public DbSet<SliceQuality.SliceQuality> SiliceQuality { get; set; }

        /// <summary>
        /// 硅片质量
        /// </summary>
        public DbSet<WaterQuality.WaterQuality> WaterQuality { get; set; }

        /// <summary>
        /// 报表配置表
        /// </summary>
        public DbSet<ReportConfig.ReportConfig> ReportConfig { get; set; }

        /// <summary>
        /// 图片表
        /// </summary>
        public DbSet<Picture.Picture> Picture { get; set; }

        /// <summary>
        /// 检查记录主表
        /// </summary>
        public DbSet<MainCheckLog.MainCheckLog> MainCheckLog { get; set; }

        /// <summary>
        /// 检查记录子表
        /// </summary>
        public DbSet<SubCheckLog.SubCheckLog> SubCheckLog { get; set; }

        /// <summary>
        /// 等级表
        /// </summary>
        public DbSet<Grade.Grade> Grade { get; set; }
        public ManagementContext(): base("YLConnection")
        {
            Database.SetInitializer<ManagementContext>(new CreateDatabaseIfNotExists<ManagementContext>());
        }
    }
}
